<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>IFE JavaScript Task 01</title>
</head>
<body>

<h3>污染城市列表</h3>
<ul id="aqi-list">
    <!--
        <li>第一名：福州（样例），10</li>
          <li>第二名：福州（样例），10</li> -->
</ul>

<script type="text/javascript">

    var aqiData = [
        ["北京", 90],
        ["上海", 50],
        ["福州", 10],
        ["广州", 50],
        ["成都", 90],
        ["西安", 100]
    ];

    (function () {
        var chineseNumbers = ["一","二","三","四","五","六","七","八","九","十"];
        var contentStr="";
        aqiData.filter(function(element){ return element[1]>60;}) //筛选出60以上
                .sort(function(a,b){return b[1]-a[1];})  //降序
                .forEach(function (element,index){           //遍历
                    contentStr+="<li>第"+chineseNumbers[index]+"名："+element[0]+","+element[1]+"</li>";
                });
        document.getElementById("aqi-list").innerHTML = contentStr;
    })();

</script>
</body>
</html>